from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.ui import WebDriverWait # available since 2.4.0
from selenium.webdriver.support.ui import Select
import time
import os
import atexit

def twait():
    time.sleep(0.5)

driver = webdriver.Chrome()

def linktext(s):
    return driver.find_element_by_partial_link_text(s)

def linkpart(s):
    return driver.find_element_by_partial_link_text(s)

def id(s):
    return driver.find_element_by_id(s)

def css(s):
    return driver.find_element_by_css_selector(s)

def clas(s):
    return driver.find_element_by_class_name(s)

def tag(s):
    return driver.find_element_by_tag_name(s)

def Edit():
    linktext("Edit").click()

def Cancel():
    linktext("Cancel").click()

def Done():
    linktext("Done").click()
    twait()

def Back():
    linktext("Back").click()
    twait()

def New():
    linktext("New").click()
    twait()



sys_time = time.time()

def print_elapsed():
    print 'elapsed time: %d seconds' % (time.time() - sys_time)

atexit.register(print_elapsed)


driver.implicitly_wait(1)

#driver.set_script_timeout(1000)

driver.get("file://" + os.getcwd() + "/../app/index.html")

twait()
